package com.czhlearn.mapper;

import com.czhlearn.pojo.Article;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @program: big-event
 * @description:
 * @author: czh
 * @create: 2023-12-19 14:19
 **/

@Mapper
public interface ArticleMapper {
    //INSERT INTO `article`(`title`, `content`, `cover_img`, `category_id`, `create_user`, `create_time`, `update_time`) VALUES
    // ('#{title}', '#{content}', '#{coverImg}', #{categoryId}, #{createUser}, '#{createTime}', '#{updateTime}')
    @Insert("INSERT INTO `article`(`title`, `content`, `cover_img`, `category_id`, `create_user`, `create_time`, `update_time`)" +
            " VALUES (#{title}, #{content}, #{coverImg}, #{categoryId}, #{createUser}, #{createTime}, #{updateTime})")
    void add(Article article);


    List<Article> getArticleList( Integer userId, String categoryId, String state);

    void update(Article article);

    Article detail(Integer id);

    void delete(Integer id);
}
